package util;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * 
 *
 */
public class ColorUtils {

	public static Color mixColors(List<Color> colorList) {
		
		int newR = 0;
		int newB = 0;
		int newG = 0;
		
		for (Color current : colorList) {
			newR = (newR + current.getRed() >= 255) ? 255 : newR + current.getRed();
			newG = (newG + current.getGreen() >= 255) ? 255 : newG + current.getGreen();
			newB = (newB + current.getBlue() >= 255) ? 255 : newB + current.getBlue();
		}
		
		return new Color(newR, newG, newB);
	}
	
	public static Color mixColors(Color c1, Color c2) {
		
		List<Color> colorList = new ArrayList<Color>();
		colorList.add(c1);
		colorList.add(c2);
				
		return mixColors(colorList);
		
	}
	
}
